#define _CRT_SECURE_NO_WARNINGS 1
#include"sort.h"

void PrintArr(int* a,int size) {
	for (int i = 0; i < size; i++) {
		printf("%d ", a[i]);
	}
	printf("\n");
}
void testinsertSort() {
	int a[] = { 1,3,5,6,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	insertSort(a, size);
	PrintArr(a, size);
}
void testbullSort() {
	int a[] = { 1,3,5,6,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	BulleSort(a, size);
	PrintArr(a, size);
}
void testheapSort() {
	int a[] = { 1,3,5,6,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	for (int i = (size - 1 - 1) / 2; i >= 0; i--) {
		AdjustDown(a, size,i);
	}
	int end = size - 1;
	while (end>0) {
		swap(&a[end], &a[0]);
		AdjustDown(a, end, 0);
		end--;
	}
	PrintArr(a, size);
}
void testshellSort() {
	int a[] = { 1,3,5,6,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	shellSort(a, size);
	PrintArr(a, size);
}
void testselectSort() {
	int a[] = { 9,3,5,6,7,8,1,4,2 };
	int size = sizeof(a) / sizeof(int);
	SelectSort(a, size);
	PrintArr(a, size);

}

void testquickSort() {
	int a[] = { 6,3,5,1,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	QuickSort(a, 0, size-1);
	PrintArr(a, size);
}

void testquickNoSort() {
	int a[] = { 6,3,5,1,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	QuickSort2(a,0,size-1);
	PrintArr(a, size);

}

void testmergeSort() {
	int a[] = { 6,3,5,1,7,8,9,4,2 };
	int size = sizeof(a) / sizeof(int);
	mergeSort(a, size);
	PrintArr(a, size);
}
int main() {
	/*testselectSort();*/
	testmergeSort();
	return 0;
}